<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>供应商管理系统-{$webname}</title>
    {Common::css('style.css,base.css,extend.css')}
    {Common::css('v1/admin.css,v1/base.css,v1/home.css')}
    {Common::js("jquery.min.js,common.js,city/jquery.cityselect.js,layer/layer.js,jquery.validate.min.js,slideTabs.js,jquery.upload.js")}
    <script>
        var SITEURL = '/supplier/';
        $(function () {
            $('.way').switchTab();
        })
    </script>
</head>
<body>
    <div class="supplier-main-block">
        <div class="content-box">
            <div class="frame-box">
                <div class="frame-con">
                    <form id="chkfrm">
                        <div class="flow-path-box">
                            <div class="flow-path-tit"><strong class="bt">资质验证</strong></div>
                            <div class="flow-path-con">
                                <div class="nr-box">
                                    {if $userinfo['verifystatus']==0}
                                    <div class="step">
                                        <span class="on">1 提交资料</span>
                                        <span>2 客服审核</span>
                                        <span>3 认证成功</span>
                                    </div>
                                    {elseif $userinfo['verifystatus']==1}
                                    <div class="step">
                                        <span><i class="cg-ico"></i>提交资料</span>
                                        <span class="on"><i class="cg-ico"></i>客服审核</span>
                                        <span>3 认证成功</span>
                                    </div>
                                    {elseif $userinfo['verifystatus']==2}
                                    <div class="step">
                                        <span><i class="cg-ico"></i>提交资料</span>
                                        <span><i class="cg-ico"></i>客服审核</span>
                                        <span class="on"><i class="sb-ico"></i>认证失败</span>
                                    </div>
                                    {elseif $userinfo['verifystatus']==3}
                                    <div class="step">
                                        <span><i class="cg-ico"></i>提交资料</span>
                                        <span><i class="cg-ico"></i>客服审核</span>
                                        <span class="on"><i class="cg-ico"></i>认证成功</span>
                                    </div>
                                    {/if}
                                    {php}
                                    $verifytype="";
                                    if(!empty($qd['mp_litpic']))
                                    {
                                    $verifytype="旅行社工作名片";
                                    }
                                    else if(!empty($qd['xk_litpic']))
                                    {
                                    $verifytype="经营许可证";
                                    }
                                    else if(!empty($qd['zz_litpic']))
                                    {
                                    $verifytype="营业执照(副本)";
                                    }

                                    {/php}

                                    {if $userinfo['verifystatus']==3}
                                    <div id="verifystatus3" class="verify-finally">
                                        <h3 class="pass-yes">恭喜，审核通过</h3>
                                        <p>你已通过供应商资质审核。你将获得供应商发布产品、结算等功能！</p>
                                        <ul class="info-item-block confirm-info-box c-666">
                                            <li>
                                                <span class="item-hd">企业名称：</span>
                                                <div class="item-bd">
                                                    <span class="item-text">{$userinfo['suppliername']}</span>
                                                </div>
                                            </li>
                                            <li>
                                                <span class="item-hd">法人代表：</span>
                                                <div class="item-bd">
                                                    <span class="item-text">{$userinfo['reprent']}</span>
                                                </div>
                                            </li>
                                            <li>
                                                <span class="item-hd">分销渠道：</span>
                                                <div class="item-bd">
                                                    {loop $channel_list $c}
                                                    {if in_array($c['id'],$channel_id)}<span class="item-text">{$c['title']}</span>&nbsp;&nbsp;{/if}
                                                    {/loop}
                                                </div>
                                            </li>
                                            <li>
                                                <span class="item-hd">产品类目1：</span>
                                                <div class="item-bd">
                                                    {php}
                                                    $apply_product = explode(',',$userinfo['authorization']);
                                                    {/php}
                                                    {loop $product_list $p}
                                                    {if in_array($p['id'],$apply_product)}<span class="item-text">{$p['modulename']}</span>&nbsp;&nbsp;{/if}
                                                    {/loop}
                                                </div>
                                            </li>
                                            <li>
                                                <span class="item-hd">认证方式：</span>
                                                <div class="item-bd">
                                                    <span class="item-text">{$verifytype}</span>
                                                </div>
                                            </li>
                                        </ul>

                                        <input type="button" value="重新认证" id="reverify_btn" class="jg-btn"/>
                                    </div>
                                    {/if}
                                    {if $userinfo['verifystatus']==1}
                                    <div class="send-success">
                                        <p>您的资料已<strong>{if $isfirstupdate==1}提交成功{else}更新成功{/if}</strong>，请等待客服审核。</p>
                                    </div>
                                    {/if}
                                    {if $userinfo['verifystatus']==2}
                                    <div id="verifystatus2" class="verify-finally">
                                        <h3 class="pass-no">认证失败</h3>
                                        <p>原因：{$userinfo['reason']}</p>
                                        <input type="button" value="重新认证" id="reverify_btn" class="jg-btn"/>
                                    </div><!-- 审核未通过 -->
                                    {/if}

                                    <div id="verifystatus0" class="way" {if $userinfo['verifystatus']!=0}style="display:none"{/if}>
                                        <div class="gy-top-box">
                                            <ul>
                                                <li>
                                                    <strong class="lm">企业名称：</strong>
                                                    <div class="zl-con">
                                                        <input type="text" name="suppliername" class="tit-text" value="{$qd['suppliername']}" id="suppliername"/>
                                                    </div>
                                                </li>
                                                <li>
                                                    <strong class="lm">法人代表：</strong>
                                                    <div class="zl-con">
                                                        <input type="text" name="reprent" class="tit-text" value="{$qd['reprent']}"/>
                                                    </div>
                                                </li>
                                                <li>
                                                    <strong class="lm">分销渠道：</strong>
                                                    <div class="zl-con">
                                                        <div class="zj-radio">
                                                            {loop $channel_list $c}
                                                            <label>
                                                                <input type="checkbox" class="apply" name="channel_id[]" value="{$c['id']}" {if in_array($c['id'],$channel_id)}checked="checked"{/if}>{$c['title']}
                                                            </label>
                                                            {/loop}
                                                        </div>
                                                    </div>
                                                </li>
                                                <li>
                                                    <strong class="lm">产品类目2：</strong>
                                                    <div class="zl-con">
                                                        <div class="zj-radio">
                                                            {php}
                                                            $apply_product = explode(',',$userinfo['authorization']);
                                                            {/php}
                                                            {loop $product_list $p}
                                                            <label>
                                                                <input type="checkbox" class="apply" name="apply_product[]" value="{$p['id']}" {if in_array($p['id'],$apply_product)}checked="checked"{/if}>{$p['modulename']}
                                                            </label>
                                                            {/loop}
                                                        </div>
                                                    </div>
                                                </li>

                                            </ul>
                                        </div>
                                        <div class="st-tabnav">
                                            <strong>验证方式：</strong>
                                            <div class="nav-list">
                                                <span>旅行社工作名片</span>
                                                <span>经营许可证</span>
                                                <span>营业执照(副本)</span>
                                            </div>
                                        </div>
                                        <div class="st-tabcon">
                                            <ul>
                                                <li>
                                                    <strong class="lm">名片正面：</strong>
                                                    <div class="zl-con">
                                                        <div class="up-pic mp_litpic">
                                                            {if !empty($qd['mp_litpic'])}
                                                            <img src="{$qd['mp_litpic']}" width="215" height="136">
                                                            {else}
                                                            支持jpg、png、gif格式，不超过2M
                                                            {/if}
                                                        </div>
                                                        <div class="upload">
                                                            <a class="up-btn" href="javascript:;" data-type="mp">+上传图片</a>
                                                        </div>
                                                        <p class="sm-txt">可上传名片的照片或者扫描文件，清晰的图片更容易通过审核。</p>
                                                    </div>
                                                </li>
                                            </ul>
                                        </div>
                                        <div class="st-tabcon">
                                            <ul>
                                                <li>
                                                    <strong class="lm">许可证号码：</strong>
                                                    <div class="zl-con">
                                                        <input type="text" name="licenseno" class="tit-text" value="{$qd['licenseno']}"/>
                                                    </div>
                                                </li>
                                                <li>
                                                    <strong class="lm">经营许可证：</strong>
                                                    <div class="zl-con">
                                                        <div class="up-pic xk_litpic">
                                                            {if !empty($qd['xk_litpic'])}
                                                            <img src="{$qd['xk_litpic']}" width="215" height="136">
                                                            {else}
                                                            支持jpg、png、gif格式，不超过2M
                                                            {/if}
                                                        </div>
                                                        <div class="upload">
                                                            <a class="up-btn" href="javascript:;" data-type="xk">+上传图片</a>
                                                        </div>
                                                        <p class="sm-txt">上传证件支持电子版/扫描版。清晰的图片更容易通过审核。</p>
                                                    </div>
                                                </li>
                                            </ul>
                                        </div>
                                        <div class="st-tabcon">
                                            <ul>
                                                <li>
                                                    <strong class="lm">营业执照号：</strong>
                                                    <div class="zl-con">
                                                        <input type="text" name="certifyno" class="tit-text" value="{$qd['certifyno']}"/>
                                                    </div>
                                                </li>
                                                <li>
                                                    <strong class="lm">营业执照：</strong>
                                                    <div class="zl-con">
                                                        <div class="up-pic zz_litpic">
                                                            {if !empty($qd['zz_litpic'])}
                                                            <img src="{$qd['zz_litpic']}" width="215" height="136">
                                                            {else}
                                                            支持jpg、png、gif格式，不超过2M
                                                            {/if}
                                                        </div>
                                                        <div class="upload">
                                                            <a class="up-btn" href="javascript:;" data-type="zz">+上传图片</a>
                                                        </div>
                                                        <p class="sm-txt">上传证件为带有最新工商局年检盖章的副本，如年检盖章在背面，请拼接处理后再上传。</p>
                                                    </div>
                                                </li>
                                            </ul>
                                        </div>
                                        <a class="submit-btn" href="javascript:;"> {if $userinfo['verifystatus']==0}提交审核{else}修改资料{/if}</a>
                                        <input type="hidden" id="mp_litpic" name="mp_litpic" value="{$qd['mp_litpic']}"/>
                                        <input type="hidden" id="xk_litpic" name="xk_litpic" value="{$qd['xk_litpic']}"/>
                                        <input type="hidden" id="zz_litpic" name="zz_litpic" value="{$qd['zz_litpic']}"/>
                                        <input type="hidden" id="reverify_type" name="reverify_type" value=""/>
                                    </div>
                                </div>
                            </div>
                        </div><!-- 验证步骤 -->
                    </form>
                </div>
            </div>
        </div>
    </div>

    {Common::js("layer/layer.js")}
    <script>
        $("#nav_qulification").addClass('on');
        //提交审核
        $(".submit-btn").click(function () {
            var reverify_type=$(".nav-list .on").text()
            $('#reverify_type').val(reverify_type)

            var suppliername = $('#suppliername').val();
            if (suppliername == '') {
                layer.msg("供应商名称不能为空", {icon: 5, time: 1200});
                return false;
            }

            var frmdata = $("#chkfrm").serialize();
            $.ajax({
                type: 'POST',
                url: SITEURL + 'pc/qualify/ajax_save_qualify',
                data: frmdata,
                dataType: 'json',
                success: function (data) {
                    if (data.status) {
                        /* layer.msg("{__('commit_qualify_ok')}", {
                             icon: 6,
                             time: 1000
                         })*/
                        // layer.msg(data.msg, {icon:1,time:2000,end:function(){
                        window.location.reload();
                        // }});
                        return false;

                    } else {
                        layer.msg(data.msg, {icon: 5});
                        return false;
                    }
                }
            })
        })

        //重新提交
        $("#reverify_btn").click(function () {
            $('.step').find('span').removeClass('on');
            $('.step').find('span').eq(0).addClass('on');
            $('.submit-btn').html('提交审核');
            $("#verifystatus0").show();
            $("#verifystatus2").hide();
            $("#verifystatus3").hide();
        });

        //上传图片
        $(".up-btn").click(function () {
            var type = $(this).attr('data-type');
            upload(type);
        })

        //上传模板
        function upload(type) {
            var contain = type + '_litpic';
            // 上传方法
            $.upload({
                // 上传地址
                url: SITEURL + 'pc/qualify/ajax_upload_litpic',
                // 文件域名字
                fileName: 'filedata',
                fileType: 'png,jpg,jpeg,gif',
                // 其他表单数据
                params: {},

                // 上传之前回调,return true表示可继续上传
                onSend: function () {
                    return true;
                },
                // 上传之后回调
                onComplate: function (data) {

                    var data = $.parseJSON(data);
                    //如果上传成功
                    if (data.status) {


                        var html = '<img src="' + data.litpic + '" width="215" height="136">';
                        $("#" + contain).val(data.litpic);
                        $("." + contain).html(html);

                    } else {
                        ST.Util.showMsg('上传失败,请检查图片', 5);
                    }


                }
            });
        }

        $(function ($) {
            $(".nav-list span").each(function () {
                if ($(this).text() == "{$verifytype}") {
                    $(this).trigger("click");
                }
            });
        });

    </script>

</body>
</html>
